import os

ropgen_dir='third_party/RoPGen'
ropgen_create_bin = os.path.join(ropgen_dir,'src/coding style attacks/author-style-transform/transform/create_directory.py')
ropgen_get_style_bin=os.path.join(ropgen_dir,'src/coding style attacks/author-style-transform/transform/get_style.py')
ropgen_targeted_attack_bin=os.path.join(ropgen_dir,'src/coding style attacks/author-style-transform/transform/targeted_attack.py')
ropgen_untargeted_attack_bin=os.path.join(ropgen_dir,'src/coding style attacks/author-style-transform/transform/untargeted_attack.py')

vnaille_DLCAIS_train_bin=os.path.join(ropgen_dir,'DLCAIS','train.py')


def ropgen_cmd(bin,base_dir,addon=''):
    cmd=f'python "{bin}" {base_dir} {addon}'
    print(cmd)
    os.system(cmd)
    
def init(base_dir):
    ropgen_cmd(ropgen_create_bin,base_dir)
    
def get_style(base_dir):
    ropgen_cmd(ropgen_get_style_bin,base_dir)
    
def targeted_attack(base_dir):
    ropgen_cmd(ropgen_targeted_attack_bin,base_dir)
    
def untargeted_attack(base_dir):
    ropgen_cmd(ropgen_untargeted_attack_bin,base_dir,'--form=all')

def train_DLCAIS():
    pass

def eval_DLCAIS():
    pass

def train_PbNN():
    pass

def eval_PbNN():
    pass


target_dir='generate_data/gcj_cpp'

init(target_dir)
#get_style(target_dir)
untargeted_attack(target_dir)